home *** CD-ROM | disk | FTP | other *** search
- #include "out.h"
-
- void pollEvents()
- {
- EventRecord anEvent;
- WindowPtr theWindow;
- short clickArea;
- Rect screenRect;
- long sleep;
-
- sleep = 0;
-
- for (;;)
- {
- if (gCurrentMove == START)
- animateCTable();
-
- if (WaitNextEvent (everyEvent, &anEvent, sleep, (RgnHandle) nil))
- {
- if (anEvent.what == mouseDown)
- {
- clickArea = FindWindow( anEvent.where, &theWindow );
-
- if (clickArea == inDrag)
- {
- screenRect = (**GetGrayRgn ()).rgnBBox;
- DragWindow(theWindow, anEvent.where, &screenRect );
- }
- else if (clickArea == inGoAway)
- {
- if (TrackGoAway( theWindow , anEvent.where ))
- cleanUp();
- }
-
- else if (clickArea == inMenuBar)
- {
- adjustMenus();
- handleMenu( MenuSelect( anEvent.where ) );
- }
- else if (clickArea == inContent)
- {
- if (theWindow != FrontWindow())
- SelectWindow( gWindow );
- }
- }
- else if (anEvent.what == updateEvt)
- {
- theWindow = (WindowPtr)anEvent.message;
-
- BeginUpdate( theWindow );
- SetPort( theWindow );
- drawImage();
- EndUpdate( theWindow );
- }
- else if (anEvent.what == keyDown || anEvent.what == autoKey)
- {
- if ((anEvent.modifiers & cmdKey) != 0)
- {
- adjustMenus();
- handleMenu( MenuKey( (char)(anEvent.message & charCodeMask) ) );
- }
- }
- else if (anEvent.what == activateEvt)
- {
- InvalRect( &gWindow->portRect );
- }
- }
- }
- }